package com.sls.web.manager.game.pojo.ekhui;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import com.sls.web.manager.game.constants.FlowDirect;
import com.sls.web.manager.game.constants.FlowType;

/**
 * 资金流水
 * @author Administrator
 *
 */
public class FundFlow implements Serializable {

	private static final long serialVersionUID = 8160537383102259202L;
	private String fundFlowId ;				
	private String flowAccountId ;				//关联的账户id
	private String flowAccountName ;			//关联的账户名称
	private String traderId ;					//所属商户id
	private String traderName ;					//所属商户名称
	private String flowType ;					//流水类型，01存款；02支付；03退款
	private Date createTime ;					//流水创建时间
	private String flowDirect ;					//资金流向，1存入；-1转出
	private BigDecimal beforeBalance ;			//流水发生前余额
	private BigDecimal money ;					//涉及金额
	private BigDecimal afterBalance ;			//流水发生后余额
	private Date accountDay ;					//账务日期
	private String billId ;						//关联的业务单id

	public FundFlow(){
		super() ;
	}
	public String getFundFlowId() {
		return fundFlowId;
	}
	public void setFundFlowId(String fundFlowId) {
		this.fundFlowId = fundFlowId;
	}
	public String getFlowAccountId() {
		return flowAccountId;
	}
	public void setFlowAccountId(String flowAccountId) {
		this.flowAccountId = flowAccountId;
	}
	public String getFlowType() {
		return flowType;
	}
	public void setFlowType(String flowType) {
		this.flowType = flowType;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getFlowDirect() {
		return flowDirect;
	}
	public void setFlowDirect(String flowDirect) {
		this.flowDirect = flowDirect;
	}
	public BigDecimal getBeforeBalance() {
		return beforeBalance;
	}
	public void setBeforeBalance(BigDecimal beforeBalance) {
		this.beforeBalance = beforeBalance;
	}
	public BigDecimal getMoney() {
		return money;
	}
	public void setMoney(BigDecimal money) {
		this.money = money;
	}
	public BigDecimal getAfterBalance() {
		return afterBalance;
	}
	public void setAfterBalance(BigDecimal afterBalance) {
		this.afterBalance = afterBalance;
	}
	public Date getAccountDay() {
		return accountDay;
	}
	public void setAccountDay(Date accountDay) {
		this.accountDay = accountDay;
	}
	public String getFlowAccountName() {
		return flowAccountName;
	}
	public void setFlowAccountName(String flowAccountName) {
		this.flowAccountName = flowAccountName;
	}
	public String getBillId() {
		return billId;
	}
	public void setBillId(String billId) {
		this.billId = billId;
	}
	public String getTraderId() {
		return traderId;
	}
	public void setTraderId(String traderId) {
		this.traderId = traderId;
	}
	public String getTraderName() {
		return traderName;
	}
	public void setTraderName(String traderName) {
		this.traderName = traderName;
	}
	public FundFlow saveDepositFundFlow(Account account , Deposit deposit , Trader trader){
		this.setAccountDay(new Date()) ;
		this.setAfterBalance(account.getBalance()) ;
		this.setCreateTime(new Date()) ;
		this.setFlowAccountId(account.getAccountId()) ;
		this.setFlowAccountName(account.getAccountName()) ;
		FlowType depositFlow = FlowType.deposit ;
		this.setFlowType(depositFlow.getCode()) ;
		this.setFlowDirect(FlowDirect.plus.getCode()) ;
		this.setMoney(deposit.getMoney()) ;
		this.setTraderId(trader.getTraderId()) ;
		this.setTraderName(trader.getTraderName()) ;
		return this ;
	}
}
